<template>
  <fieldset class="sonthcom">
    <legend>子组件的区域</legend>
    <p>我的性别是:{{sonmsg}}
    </p>
    <p class="p1">
        我的优点是：{{sonmsg.youdian}}
    </p>
  </fieldset>  
</template>

<script setup>
import { reactive, ref, watch } from "vue";
const Obj = defineProps(['sonmsg'])
let gender = ref('')
let list = reactive([])
// props自定义属性根据传递的值发生更新（自动）
watch(Obj.sonmsg,(newVal)=>{
    if (newVal.gender != ''){ gender.value = newVal.gender;
         list.push({
        gender:newVal.gender,
        youdian : newVal.youdian
    }) 
    
    } 
},{Immediate:true} )
    
</script>

<style>

</style>